def solve(s: str):
    l = len(s)
    index = -1
    begin = 0
    i = l-1
    while i >= 0:
        if s[i] == 'l' or s[i] == 'q' or s[i] == 'b':
            i -= 1
        else:
            index = i
            break
    if index == -1:
        print('Yes')
        return
    i = 0
    while i < index+1:
        if s[i] == 'l' or s[i] == 'q' or s[i] == 'b':
            i += 1
        else:
            begin = i
            break
    l1 = list(s[begin:index+1])
    l2 = l1.copy()
    l2.reverse()
    for j in range(index+1-begin):
        if l1[j] != l2[j]:
            print('No')
            return
    print('Yes')
    return

t = int(input())
for i in range(t):
    s = input()
    solve(s)
# l q b
